﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LiveSequence.Common.Domain;

namespace LiveSequence.Common.Engine
{
  public class CecilAssemblyParserOptions
  {
    private SortedDictionary<string, CecilAssemblyOptions> _AsseamblyOptions;

    public CecilAssemblyParserOptions()
    {
      _AsseamblyOptions = new SortedDictionary<string, CecilAssemblyOptions>();
    }

    public void AddAssembly(string strAssemblyName, string strFullPath)
    {
      if(!_AsseamblyOptions.ContainsKey(strAssemblyName))
      {
        CecilAssemblyOptions assemblyOptions = new CecilAssemblyOptions(strAssemblyName, strFullPath);
        _AsseamblyOptions.Add(strAssemblyName, assemblyOptions);

        assemblyOptions.Ignored = !Rules.IsValidAssembly(strAssemblyName);

      }
    }

    public bool IsIgnored(string strAssemblyName)
    {
      bool bResult = false;
      if(_AsseamblyOptions.ContainsKey(strAssemblyName))
      {
        CecilAssemblyOptions assemblyOptions = _AsseamblyOptions[strAssemblyName];
        bResult = assemblyOptions.Ignored;
      }
      return bResult;
    }

    public SortedDictionary<string, CecilAssemblyOptions> AssemblyOptions
    {
      get
      {
        return _AsseamblyOptions;
      }
    }
  }
}
